package com.losdun.points.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.losdun.points.domain.PointsGoodsCategory;
import com.losdun.points.mapper.PointsGoodsCategoryMapper;
import com.losdun.points.service.PointsGoodsCategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 积分商品分类表service实现类
 *
 * @author swordye
 * @date 2025-05-19
 */
@Slf4j
@Service
public class PointsGoodsCategoryServiceImpl extends ServiceImpl<PointsGoodsCategoryMapper, PointsGoodsCategory> implements PointsGoodsCategoryService {

    @Autowired
    private PointsGoodsCategoryMapper pointsGoodsCategoryMapper;

    @Override
    public List<PointsGoodsCategory> queryList(PointsGoodsCategory pointsGoodsCategory) {
        return baseMapper.selectList(new QueryWrapper<>(pointsGoodsCategory).orderByAsc("sort"));

    }

    @Override
    public List<PointsGoodsCategory> queryAllCategory() {
        LambdaQueryWrapper<PointsGoodsCategory> qw = new LambdaQueryWrapper<>();
        qw.eq(PointsGoodsCategory::getStatus,1).orderByAsc(PointsGoodsCategory::getSort);
        return baseMapper.selectList(qw);
    }
}
